// const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin')
module.exports = {
    devServer: {
        port: 8080,
        open: true, //自动打开浏览器
    },
    lintOnSave: false,
    assetsDir: 'static',
    parallel: false,
    publicPath: './',
    configureWebpack: {
        optimization: process.env.NODE_ENV == 'production' ? {
            minimize: true,
            minimizer: [
                new TerserPlugin({
                    exclude: /\.min\.js$/,
                    cache: true,
                    sourceMap: false,
                    // 多进程
                    parallel: true,
                    // 移除注释
                    extractComments: false,
                    terserOptions: {
                        ecma: undefined,
                        warnings: false,
                        parse: {},
                        compress: {
                            drop_console: false,
                            drop_debugger: false,
                            pure_funcs: ['console.log'], // 移除console
                        },
                        format: {
                            comments: false,
                        },
                    },
                })
            ],
        } : {},
    },
}